export  namespace OG {
    /**坐标类 */
    export class Positon {
        public x:number = 0;
        public y:number = 0;

        public constructor (x:number = 0,y:number = 0) {
            this.x = x;
            this.y = y;
        }
    }

    /**尺寸类 */
    export class Size {
        public width: number = 0;
        public height: number = 0;

        public constructor(width:number = 0,height:number = 0) {
            this.width = width;
            this.height = height;
        }
    }

    /**画笔类*/
    export class PaintBrush {
        /**设置或返回用于填充绘画的颜色、渐变或模式 */
        public fillStyle:string = "";
        /**设置或返回用于笔触的颜色、渐变或模式*/
        public strokeStyle:string = "";
        /**设置或返回用于阴影的颜色*/
        public shadowColor:string = "";
        /**设置或返回用于阴影的模糊级别*/
        public shadowBlur:number = 0;
        /**设置或返回阴影距形状的水平距离*/
        public shadowOffsetX:number = 0;
        /**设置或返回阴影距形状的垂直距离*/
        public shadowOffsetY:number = 0;
        /**设置或返回线条的结束端点样式*/
        public lineCap:CanvasLineCap = "butt";
        /**设置或返回两条线相交时，所创建的拐角类型 */
        public lineJoin:CanvasLineJoin = "miter";
        /**设置或返回当前的线条宽度*/
        public lineWidth:number = 1;
        /**设置或返回最大斜接长度*/
        public miterLimit:number = 10;

        private ctx:CanvasRenderingContext2D = null;
        /**绑定绘制上下文context */
        public constructor(context:CanvasRenderingContext2D) {
            this.ctx = context;
        }

        /**更新画笔 */
        public UpdateBrush() {
            if(this.ctx != null) {
                this.ctx.fillStyle = this.fillStyle;
                this.ctx.strokeStyle = this.strokeStyle;
                this.ctx.shadowColor = this.shadowColor;
                this.ctx.shadowBlur = this.shadowBlur;
                this.ctx.shadowOffsetX = this.shadowOffsetX;
                this.ctx.shadowOffsetY = this.shadowOffsetY;
                this.ctx.lineCap = this.lineCap;
                this.ctx.lineJoin = this.lineJoin;
                this.ctx.lineWidth = this.lineWidth;
                this.ctx.miterLimit = this.miterLimit;
                return this.ctx;
            }
            return null;
        }
    }
    
}